Skip to content

[2.0] Fixes 38703: Make dbt BigQuery wildcard sources upstream of every table they read (backport 2.0 #38704) - #38707

Merged
ulixius9 merged 2 commits into
2.0from
backport/2.0/pr-38704
Nov 27, 2026
Merged

ulixius9 merged 2 commits into
2.0from
backport/2.0/pr-38704

Conversation

@ulixius9

Copy link
Copy Markdown
Member

Describe your changes:

Fixes #38703

Cherry-pick of #38704 to 2.0. On 2.0, shardedTables already catalogs BigQuery shard families (#37002), but a dbt source declared as a wildcard table (GA4's events_*) still produces no dbt lineage: its identifier is escaped and looked up as one literal table. #38704 has the full description, design and rejected alternatives. In short:

  • For BigQuery services, the data model keeps the wildcard FQN as an upstream, and create_dbt_lineage expands it into one edge per table the wildcard reads (both the daily and the intraday families).
  • The expansion searches where every other dbt node is looked up: catalogMapping, the manifest database, then other services when searchAcrossDatabases is set.
  • An unmatched wildcard is reported and gets no edge.
  • An incomplete match (over 100 tables, date-constrained, or spread over several services) is reported. Both lineage stages of that model then add edges without overriding, so the wildcard's earlier edges survive.
  • Tests and exposures, and engines without wildcard tables, keep the literal lookup.
  • The rule is recorded as v3 of ADR:2026-11-03-bigquery-daily-shards-use-stable-logical-tables.

What differs from main. 2.0 predates the dbt resolved-table cache (#38291), so the cherry-pick conflicted in yield_data_models:

  • Only the new wildcard_expansions.clear() is kept there.
  • The run cache is sized with LRU_CACHE_SIZE and imports LRUCache directly, because RESOLVED_TABLES_CACHE_SIZE does not exist on 2.0.
  • The rest applied unchanged on top of 2.0's older parent lookup.

Type of change:

  • Bug fix

High-level design:

Same as #38704.

Tests:

Use cases covered

Same as #38704: every test there applies unchanged to 2.0.

Unit tests

  • I added unit tests for the new/changed logic (cherry-picked from Fixes 38703: Make dbt BigQuery wildcard sources upstream of every table they read #38704).
  • Local run on the 2.0 worktree. Models were regenerated from 2.0's schemas with the pinned datamodel-code-generator==0.83.0, and imports were checked to resolve to the 2.0 tree:
    pytest tests/unit/entity_resolution/ tests/unit/test_dbt.py tests/unit/test_dbt_ingest.py tests/unit/test_dbt_test_definition.py tests/unit/test_dbt_test_descriptions.py tests/unit/test_dbt_config_errors.py tests/unit/test_dbt_http_config.py tests/unit/topology/database/test_bigquery.py tests/unit/topology/database/test_bigquery_sharding.py
    → 629 passed, 0 failed.
  • Coverage %: not measured.

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • Not run: no dbt or BigQuery integration test covers a wildcard source.

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

The bug was found on a 2.0.10 dbt Cloud + BigQuery ingestion run (see #38703). The fix has not yet been re-run against that environment.

UI screen recording:

Not applicable: ingestion-only bug fix.

Checklist:

🤖 Generated with Claude Code

A dbt source whose identifier ends in * (events_*) is a BigQuery wildcard
table. Upstream parsing looked it up as one literal table, found nothing and
dropped it, so models reading GA4-style sources lost that lineage.

For services whose resolver supports wildcard tables (BigQuery), the data
model now keeps the wildcard FQN as an upstream, and create_dbt_lineage
expands it into one edge per match. The expansion searches where every other
dbt node is looked up (catalogMapping database, then the manifest database,
across services when searchAcrossDatabases is set) and runs once per run.
An unmatched wildcard is reported and gets no edge instead of a single-table
lookup. An incomplete match (over the candidate limit, date-constrained, or
spread over several services) is reported, and both lineage stages of that
model add their edges without overriding. Tests and exposures still need one
table, and other engines keep the identifier literal.

Records the rule as v3 of
ADR:2026-11-03-bigquery-daily-shards-use-stable-logical-tables.
@ulixius9
ulixius9 requested a review from a team as a code owner November 25, 2026 14:30
@ulixius9
ulixius9 requested review from harshsoni2024 and removed request for a team November 25, 2026 14:30
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@gitar-bot

gitar-bot Bot commented Nov 27, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk

Expanding BigQuery dbt wildcard sources into lineage edges changes catalog dependency records; incomplete matches may leave dependencies missing or preserve stale edges.

Makes dbt BigQuery wildcard sources (such as GA4's events_*) expand into one upstream lineage edge per matching shard table, covering both daily and intraday families, via the 2.0 backport of #38704 with conflict resolution in yield_data_models. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@ulixius9
ulixius9 merged commit 60412ba into 2.0 Nov 27, 2026
67 of 69 checks passed
@ulixius9
ulixius9 deleted the backport/2.0/pr-38704 branch November 27, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant